<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>超级管理员</title>
    <link href="../css/bootstrap.min.css" type="text/css" rel="stylesheet" />
    <script src="../js/jquery.min.js"></script>
    <style>
        /*设置背景*/
        body{
            background-color: rgba(246, 245, 244, 0.45);
        }
        #add_tea{
            margin-top: 30px;
            margin-left: 45%;
            margin-bottom: 50px;
        }
        /*表格样式*/
        #tab_three_table{
            width: 700px;
            font-size: 15px;
            margin: auto;
            margin-top: 40px;
        }
        tr{
            height: 50px;
        }
    </style>

    <script>
        $(function () {
            //页面一加载就向后台发送ajax请求
            $.get("superAdmain/queryTeacher",{},function (data) {
                //字符串拼接
                var str = '<tr class="info">\n' +
                    '        <th>账号</th>\n' +
                    '        <th>姓名</th>\n' +
                    '        <th>性别</th>\n' +
                    '        <th>手机号</th>\n' +
                    '        <th>管理楼栋号</th>\n' +
                    '        <th>是否删除</th>\n' +
                    '\n' +
                    '    </tr>';

                //遍历data数组
                for (var i = 0; i < data.length; i++) {
                    if (i%2 == 0){
                        str += '<tr class="active">\n' +
                            '        <td>'+data[i].account+'</td>\n' +
                            '        <td>'+data[i].tname+'</td>\n' +
                            '        <td>'+data[i].gender+'</td>\n' +
                            '        <td>'+data[i].phone+'</td>\n' +
                            '        <td>'+data[i].building+'</td>\n' +
                            '        <td><a href="superAdmain/delTeacher?account='+data[i].account+'">删除</a></td>\n' +
                            '    </tr>';
                    }else{
                        str += '<tr class="info">\n' +
                            '        <td>'+data[i].account+'</td>\n' +
                            '        <td>'+data[i].tname+'</td>\n' +
                            '        <td>'+data[i].gender+'</td>\n' +
                            '        <td>'+data[i].phone+'</td>\n' +
                            '        <td>'+data[i].building+'</td>\n' +
                            '        <td><a href="superAdmain/delTeacher?account='+data[i].account+'">删除</a></td>\n' +
                            '    </tr>';
                    }
                }
                //将拼接好的字符串放入table标签体中
                $("#tab_three_table").html(str);
            },"json");
        })
    </script>

</head>
<body>
    <a href="add_teacher.html" class="btn btn-info" id="add_tea">添加宿管</a>
<!-- 学生调换宿舍的申请 -->
<table class="table table-hover" id="tab_three_table">
    <tr class="info">
        <th>账号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>手机号</th>
        <th>管理楼栋号</th>
        <th>是否删除</th>

    </tr>
<!--    <tr class="active">-->
<!--        <td>XXXXXXXXXXXXXXXX</td>-->
<!--        <td>张三</td>-->
<!--        <td>男</td>-->
<!--        <td>15973654785</td>-->
<!--        <td>61</td>-->
<!--        <td><a href="#">删除</a></td>-->
<!--    </tr>-->
<!--    <tr class="info">-->
<!--        <td>XXXXXXXXXXXXXXXX</td>-->
<!--        <td>张三</td>-->
<!--        <td>男</td>-->
<!--        <td>15973654785</td>-->
<!--        <td>61</td>-->
<!--        <td><a href="#">删除</a></td>-->
<!--    </tr>-->
</table>
</body>
</html>